<?php
namespace App\Listener\Order;

use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Event\Annotation\Listener;

/**
 * @Listener 
 */
class MoneyCountListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            \App\Event\Order\StatusOkEvent::class,
        ];
    }
    
    // 填充积分总额和需释放积分
    public function process($event)
    {
        // 赠送积分倍数
        $money = $event->level->money($event->order->total);
        
        $event->order->setMoneyCount($money);
    }
}